<template>
  <div v-if="isVisible" class="progress-bar">
    <div class="progress" :style="{ width: progress + '%' }"></div>
    <div class="text">{{ text }}</div>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  computed: {
    ...mapState({
      isVisible: (state) => state.progressBar.isVisible,
      progress: (state) => state.progressBar.progress,
      text: (state) => state.progressBar.text
    })
  }
}
</script>

  <style>
   * {
     user-select: none;
   }
    .progress-bar {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 10vh;
      background-color: #f0f0f0;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;

      /* 外阴影：增加立体感 */
      box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1), /* 底部阴影 */
        0 1px 3px rgba(0, 0, 0, 0.08); /* 柔和阴影 */
    }

    .progress {
      height: 12px;
      background: linear-gradient(to right, #42b983, #66c2a5); /* 渐变背景 */
      transition: width 0.2s linear;
      border-radius: 6px;
      /* 内阴影：增加立体感 */
      box-shadow:
        inset 2px 2px 4px rgba(255, 255, 255, 0.5), /* 左上角内高光 */
        inset -2px -2px 4px rgba(0, 0, 0, 0.1); /* 右下角内阴影 */
    }

    .text {
      margin-top: 8px;
      font-size: 16px;
      color: #333;
      text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); /* 文字阴影 */
    }
  </style>
